LabSocket - The Easy Way to Extend LabVIEW to the Web

Technical Details

LabSocket enables remote access to LabVIEW applications from desktop or mobile web browsers without the need for browser plugins or a client-side run time engine. The system automatically creates a web page representation of a LabVIEW application ("Target VI") front panel and dynamically synchronizes the contents of the web page and front panel.

Overview

LabSocket runs unobtrusively on the LabVIEW host platform in parallel to the Target VI and performs two key functions.

  • First, on startup, LabSocket performs a Screenscrape of the Target VI front panel. This process involves generating HTML and JavaScript browser client code that will render the Target VI front panel in a browser. This code is then posted to an HTTP server on the LabSocket Server platform.
  • The second function, Dynamic Synchronization, occurs when a browser connects to the system after loading the client code. This function continuously synchronizes the properties of the elements on the Target VI front panel with those in the browser.



LabSocket-Basic is Certified as Compatible with LabVIEW

LabSocket is
"Compatible with LabVIEW" and
Listed in the LabVIEW Tools Network

The same element types are supported in both Basic and MultiClient client mapping modes. Tables of supported elements are available here.

Further details of the relationship between Target VI and browser clients and transmission of messages between these endpoint are presented below in the section on "Client Mapping".

Also below is information on the "LabSocket Server", User Authentication options and System Requirements.


Client Mapping

LabSocket features two configurations in which browser clients are interfaced, or mapped, to the Target VI.

  • Basic Client Mapping is a 1:N mapping between a Target VI and browser clients. In this configuration, each browser that connects to the system is synchronized with the same Target VI.
  • MultiClient Client Mapping is an N:N mapping between Target VI instances and browser clients. In this mapping configuration, each browser connects to and is synchronized with a unique instance of the Target VI.

The client mapping mode is based on the LabSocket API VI used to invoke the system. "LabSocket Start.vi" invokes Basic mapping and "LabSocket-MC Start.vi" is used for MultiClient mapping. Both of these VIs are added to Tools Palette when installing the LabSocket VIPM package. An overview of the use of these VIs is presented below. Additional details are presented in the LabSocket User Guide (See Section 5, LabSocket Application Development).

Basic Client Mapping

In Basic mapping, the VI "LabSocket Start.vi" is placed on the block diagram on the LabVIEW application being extended to the web (the "Target VI"). "LabSocket Start.vi" in turn launches the LabSocket Support VIs which perform the front panel screenscrape and dynamically synchronizes the Target VI front panel with each browser that connects to the system.

Basic Client Mapping
Basic Client Mapping - Extends a Target VI to One or More Browsers

How it Works
When a browser connects to the system the properties of the elements on the front panel of the Target VI are continuously monitored. If a change occurs to a property of a front panel element, a message containing the updated property information is transmitted via TCP/IP socket to a message broker. The message broker then forwards this message using a WebSocket connection to the browser which in turn updates the corresponding browser element property. When the user changes the value of a control in the browser, an update is sent via WebSocket and TCP/IP socket to the LabSocket Support VIs. The Support VIs then update the corresponding front panel element in the Target VI.

Client to Target VI Mapping
If more than one browser connects simultaneously to the Target VI, the same content appears in each browser and each user may control the Target VI. In some circumstances, it may be necessary for each browser client to establish a connection with a unique instance of the Target VI. MultiClient mapping, presented below, was developed to meet this requirement.

LabSocket Server
For production applications, the commercial version of the LabSocket software typically uses the HTTP server and message broker contained within a "LabSocket Server" Virtual Machine (VM). This VM can also be used with the LabSocket evaluation package. One benefit of the use of this Virtual Machine is that it enables the entire LabSocket system to be easily set up within a customer LAN. The LabSocket Server VM is supplied for free with all evaluation and commercial versions of the LabSocket system.

For initial use of the LabSocket evaluation package or for checkout of the commercial system, the HTTP server and message broker on an existing cloud server operated by Bergmans Mechatronics, LLC can also be used. This option is ideally suited for getting started quickly with either version of the system. The LabSocket Server section contains more information about the LabSocket Server VM and physical locations of the HTTP server and message broker.

MultiClient Mapping

MultiClient Mapping provides a one-to-one mapping between each browser client and a unique instance of the Target VI. This version of the system is designed for applications in which users enter or retrieve user-specific information, such as surveys, data entry, etc.

How it Works
As shown in the figure below, a top-level VI known as the "Server VI" is used to identify the Target VI prototype and to invoke the LabSocket Support VIs.

The LabSocket Support VIs perform the same initial Screenscrape function as in Basic Client Mapping mode. System behavior is slightly different during Dynamic Synchronization however: As each browser client connects to the system, the Support VIs create and start a copy of the Target VI prototype and then maintain synchronization between the each browser and Target VI instance. When a browser client disconnects from the system, the corresponding Target VI instance is stopped and deleted.

MultiClient Client Mapping
LabSocket-MultiClient - Extend Unique Instances of a Target VI to Separate Browsers

LabSocket Server
The same LabSocket Server software is used for MultiClient mapping as for Basic mapping.

Communication Between Server VI and Target VI Instances
Existing LabVIEW interprocess communication mechanisms such as global variables, functional globals or queues may be used to transmit data between the Target VI instances and the Server VI.

One scenario in which this capability could be used is to enable a quiz administrator to monitor the progress of each participant in quiz. A demonstration of the use of a LabVIEW queue for quiz monitoring is shown below. Note that in this demonstration, the Server VI itself has been extended to the web by the use of Basic client mapping.

Additional Information about MultiClient Mapping

  • Comments on how LabVIEW and the use of LabSocket in MultiClient mapping mode (formerly known as LabSocket-MultiClient) can be thought of as an easy-to-use authoring tool for dynamic web applications that could help alleviate the Bay Area's "Engineer Crunch": http://labsocket.com/engineer_crunch_solution.html
  • An early prototype of MultiClient mapping was used in the Dynasys SportJury application: http://labsocket.com/example.html

LabSocket Server

An important component of both the evaluation and commercial versions of the system is the "LabSocket Server" software that acts as a bridge between LabVIEW and the browser. This software consists primarily of an HTTP server and message broker. The two main configurations for this software are:

  1. An existing Cloud Server (Quick-Start Option) This option is available for free for use with the LabSocket evaluation software and enables developers to get started quickly with the use of the system. The Cloud Server option may also be used for initial testing of commercial versions of the LabSocket system.
  2. Customer-Operated Virtual Machine (Most Popular for Production) A pre-configured VirtualBox Virtual Machine (VM) containing the HTTP server and message broker is available for use with evaluation and commercial versions of the LabSocket software.

    Notes about the LabSocket Server VM:
    • Supplied for free with all versions of LabSocket system
    • May be installed on LabVIEW Host Platform or standalone machine
    • Enables the entire LabSocket system to be easily set up within a customer LAN
    • Assures customers complete control and ownership of the system and their data
    • Simplifies implementation of LDAP-based user authorization and administration

Commercial users can also use one of the following two LabSocket Server implementations. Please contact BML to discuss and request these options.

  1. Customer Cloud Server A pre-configured cloud server instance that contains the LabSocket Server software can be leased for the exclusive use of a customer.
  2. Native Operation Free, detailed instructions are provided for setting up the individual LabSocket Server components directly on a customer's Windows, Mac or Linux platform.

User Authentication and Administration

By default, remote access to a Target VI via a browser is unrestricted. To provide control of remote access to the system, a user authentication function can be enabled by the use of the "Authentication Required" input to the top-level LabSocket Support VI.

If authentication is enabled, users will be prompted to enter credentials in a pop-up window upon loading the Target VI web page (see below)

User Authentication
User Authentication Pop-Up Window

In the simplest user authentication implementation, credentials for approved users are stored in an XML-formatted configuration file that is loaded when the message broker is started. This option is suitable for applications in which no or few changes are necessary to the list of authorized users.

LDAP-based User Authentication and Administration
For situations in which regular user management is necessary, authentication against an industry standard Lightweight Directory Access Protocol (LDAP) database may be performed.

When the LabSocket system is configured to use an LDAP server, the message broker checks the supplied user credentials against those in the specified LDAP database, as shown in the figure below. If the credentials match, remote access to the Target VI is granted, otherwise, access is denied.

A Virtual Machine containing an OpenLDAP server and browser-based phpLDAPadmin user-management software may be purchased from Bergmans Mechatronics, LLC for a nominal fee. BML can also assist with interfacing the LabSocket system to a customer's existing LDAP database.

LDAP User Authentication
User Authentication Using LDAP Server


System Requirements

Browsers

Browsers that use the LabSocket system must be compatible with the HTML5 WebSocket interface standard. Most modern mobile and desktop browsers meet this requirement. A complete list of WebSocket-compatible browsers is available at: http://caniuse.com/websockets

For developers who require support for older browsers such as Internet Explorer 9.0 and earlier, the Kaazing WebSocket Gateway can be provided to emulate the behavior of the WebSocket interface.

Desktop LabVIEW Host Platform (Basic and MultiClient Client Mapping)

  • LabVIEW 2013 32-bit or later. Support for earlier versions of LabVIEW is available upon request.
  • Minimum Hardware: 2.3 GHz CPU and 4 GB memory
  • Operating System: Windows (XP or later). Support for Mac OSX and Linux is available upon request.

NI Real-Time Linux Host Platform (Basic Client Mapping Only)

  • Development platform: LabVIEW 2013 or later.
  • Real-Time platforms: cRIO-903x platforms only. Support for other RT platforms pending. Contact Bergmans Mechatronics for more information.

LabSocket Server Virtual Machine Host

The LabSocket Server Virtual Machine (VM) operates within the free Oracle VirtualBox virtualization application. Requirements for the VirtualBox host are:

Other notes:

  • For Basic and MultiClient mapping applications, VirtualBox and the LabSocket Server VM may be installed on the LabVIEW Host Platform.
  • The LabSocket Server VM can be supplied as a VMware vSphere VM upon request.

Ports

Access to port 61613 on LabSocket Server from the LabVIEW platform and access to port 61614 on LabSocket Server from the browser.

Back to Top of Page Top